package com.zzyl.serve.controller.member;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/member/orders/project")
public class ProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation("分页查询护理项目信息")
    public TableDataInfo getPage (
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
            @RequestParam(value = "status", required = false) Integer status
          )
     {
        startPage();
        List<NursingProject> nursingProjectList = nursingProjectService.selectPage(name,status,pageNum, pageSize);
        return getDataTable(nursingProjectList);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据id查询护理项目信息")
    public AjaxResult getById(@PathVariable("id") Integer id) {
        NursingProject nursingProject = nursingProjectService.selectNursingProjectById(id);
        return success(nursingProject);
    }
}
